<%- include ../common/header %>
<link rel="stylesheet" type="text/css" href="/css/common/dialog.css" />
<link rel="stylesheet" type="text/css" href="/css/users/experience.css" />
<!-- <link rel="stylesheet" type="text/css" href="/css/users/swiper.min.css" /> -->
<!-- <script src="/js/libs/swiper.min.js"></script> -->
<style>
.wrap{
	position: relative;
}
/*.content{
	position: absolute;
    bottom: 0px;
    left: 0px;
    height: 8.8rem;
}*/
.swiper-container-horizontal>.swiper-pagination-bullets, .swiper-pagination-custom, .swiper-pagination-fraction{
	bottom: 20px;
}
.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #fff;
    opacity: 1;
}
.swiper-pagination-bullet-active {
    background: #fff;
    width: 20px;
    border-radius: 50px;
    transition: all 0.2s ease-in-out;
}
</style>
<div class="swiper-container">
	<!-- <div class="swiper-wrapper"> -->
		<!-- <div class="swiper-slide img1"></div>
		<div class="swiper-slide img2"></div>
		<div class="swiper-slide img3"></div> -->
		<div class="swiper-slide img4" id="target">
			<div class="content">
				<span class="free" id="free">随便逛逛</span>
				<span class="login" id="login">立即登录</span>
			</div>
		</div>
	<!-- </div> -->
	<!-- <div class="swiper-pagination"></div> -->
</div>

<script src="/js/common/ajax.js" type="text/javascript"></script>
<script src="/js/libs/jquery.js" type="text/javascript"></script>
<script src="/js/common/yingSoftPrg.js" type="text/javascript"></script>
<script src="/js/common/yingSoftCookie.js" type="text/javascript"></script>
<script src="/js/common/agentInfo.js" type="text/javascript"></script>
<script src="/js/common/storage.js" type="text/javascript"></script>
<script src="/js/common/dialog.js" type="text/javascript"></script>
<script language="javascript">
	// var mySwiper = new Swiper('.swiper-container', {
	// 	pagination: '.swiper-pagination',
	// 	observer:true,//修改swiper自己或子元素时，自动初始化swiper
 //    	observeParents:true,//修改swiper的父元素时，自动初始化swiper
	// 	onSlideChangeStart :function(swiper){
	// 		index=swiper.activeIndex;
	// 		if(index>2){
	// 			$('.swiper-pagination').hide(); 
	// 		}else{
	// 			$('.swiper-pagination').show();
	// 		}
	// 	}
	// });
//	window.onload=function(){
//		if(_getClientType() == "web_android"){
//			console.log(123)
//		}else if(_getClientType() == "web_iphone" || "ipad" || "iphone") {
//          //iOS======================================================
//        	parent.window.location.href = 'ioszx://asd';
//			
//      }
//		
//	}
	var free = document.getElementById('free');
	var login = document.getElementById('login');

	free.onclick = function() {
		freeTry();
	}
	login.onclick = function() {
			window.location.href = '/login?liu=liu';
	}
	function freeTry() {
		var clientType = G_Prg.getQueryString('clientType', true);
		var clientTypeCookie = G_Cookie.getClientType();
		// if (clientType === 'iphone' || clientTypeCookie === 'iphone') {
			var data = {
				"agentCode" : G_AgentInfo.getAgentCode(),
				"guid" : G_Cookie.getGuid(),
				"clientType" : clientType
			}
			G_AjaxApi.post('/api/user/freeFegist/', data, false, function (json) {
				var jsonData = JSON.parse(json);
				if (jsonData && jsonData.status === 200) {
	                //保存一些必要的Cookie
	                var clientType = G_Cookie.getClientType();
	                var iosVersion =G_Prg.getCookie('IOSVERSION');
	                var androidVersion=G_Prg.getCookie('VERSION');
					G_Prg.cleanCookie();
					G_Cookie.setClientType(clientType);
					G_Prg.setCookie('IOSVERSION',iosVersion);
					G_Prg.setCookie('VERSION',androidVersion);
					G_Cookie.setUserID(jsonData.data.userID);
					G_Cookie.setUserName(jsonData.data.userName);
					G_Cookie.setGuid(jsonData.data.guid);
					G_Prg.setCookie('NICKNAME',jsonData.data.NickName);
					G_Prg.setCookie('freeTry','true');		// 体验
					// console.log(G_Cookie.getUserID(),G_Cookie.getUserName());
					window.location.href = '/switchMenu';
					return;
				}
				if (jsonData && (jsonData.status === 201 || jsonData.status === 203)) {
					G_Prg.alert(jsonData.msg);
					return;
				}
				if (jsonData.status === 300) {
					window.scrollTo(0, 0);
					G_Prg.throw ('程序运行错误，UserLogin._login,数据库获取数据异常');
				} else if(jsonData.status >= 400 && jsonData.status < 500){
				}else{
					G_Prg.throw ('程序运行错误!:"' + jsonData.msg + '"!status:' + jsonData.status);
				}
			});
		// } else {
		// 	window.location.href = '/switchMenu?fromUrl=login';
		// }
	}
	function _getClientType() {
		var browser = {
			versions : function () {
				var u = navigator.userAgent,
				app = navigator.appVersion;
				return {
					ios : !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
					android : u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
					iPhone : u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1,
					iPad : u.indexOf('iPad') > -1,
					webApp : u.indexOf('Safari') == -1
				};
			}
			()
		};
		if (browser.versions.iPhone || browser.versions.iPad) {
			return 'web_iPhone';
		}
		if (browser.versions.ios || browser.versions.android || browser.versions.webApp) {
			return 'web_android';
		}
		return 'web_pc';
	}

</script>
<%- include ../common/footer %>
